import pygame


#没有这句会报font not initialized
pygame.init()
pygame.mixer.init()

# 屏幕大小的常量
SCREEN_RECT = pygame.Rect(0, 0, 480, 700)
bg_size = width,height = SCREEN_RECT.width,SCREEN_RECT.height
#  创建游戏的窗口
screen  = pygame.display.set_mode(bg_size,0,32)
clock   = pygame.time.Clock()


# 中弹图片索引
hero_destroy_index = 0
e1_destroy_index = 0
e2_destroy_index = 0
e3_destroy_index = 0

#添加标题
pygame.display.set_caption("飞机大战")
BLACK = (0,0,0)
GREEN = (0,255,0)
RED = (255,0,0)
WHITE = (255,255,255)

# 用于延迟
delay = 100

# 用于切换图片
switch_image = True

# 用于阻止重复打开记录文件
recorded = False

# 统计分数
score = 0
score_font = pygame.font.Font("font/font.otf", 36)

# 游戏结束画面
gameover_font = pygame.font.Font("font/font.otf", 48)
restart_image = pygame.image.load("images/restart_nor.png")
restart_rect = restart_image.get_rect()
quit_image = pygame.image.load("images/quit_nor.png")
quit_rect = quit_image.get_rect()


# 刷新的帧率
FRAME_PER_SEC = 60
# 创建敌机的定时器常量
CREATE_ENEMY_EVENT = pygame.USEREVENT
# 英雄发射子弹事件
HERO_FIRE_EVENT = pygame.USEREVENT + 1

enemy_hit = []


